<%--
    Document   : index
    Created on : 12.02.2010, 22:48:51
    Author     : Morfant
--%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="stud.cp.user.valueobjects.Property"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java"%>

<html>
    <%@include file="/header.jsp" %>
    <body>
        <div class="page">
            <%@include file="/cap.jsp" %>
            <div id="main">
                <%Integer object_type_id = (Integer) request.getAttribute(PluginConst.object_TYPE_ID);
                            if (object_type_id != null) {%>
                <div id="objectmenucontainer">
                    <ul id="objectmenu">
                        <li><a href="<%= response.encodeURL("object-type-action.do")
                                                + "?"
                                                + PluginConst.SUBACTION
                                                + "="
                                                + PluginConst.GET_VIEW_PAGE
                                                + "&"
                                                + PluginConst.object_TYPE_ID
                                                + "="
                                                + object_type_id%>">Просмотр данных</a></li>
                        <li><a href="<%= response.encodeURL("object-type-action.do")
                                                + "?"
                                                + PluginConst.SUBACTION
                                                + "="
                                                + PluginConst.GET_object_TYPE_PROPERTIES_LIST
                                                + "&"
                                                + PluginConst.object_TYPE_ID
                                                + "="
                                                + object_type_id%>">Список свойств</a></li>
                    </ul>
                </div>

                <h2>Список включенных свойств</h2>
                <table id="buttontable">
                    <tr>
                        <th>
                            <div id="objectmenucontainer">
                                <ul id="objectmenu">
                                    <li>
                                        <a href="<%= response.encodeURL("object-type-action.do")
                                                                + "?"
                                                                + PluginConst.SUBACTION
                                                                + "="
                                                                + PluginConst.ADD_PROPERTIES_TO_object_TYPE_PAGE
                                                                + "&"
                                                                + PluginConst.object_TYPE_ID
                                                                + "="
                                                                + object_type_id%>">
                                            Добавить свойство
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </th>
                    </tr>
                </table>
                <% List<Property> list =
                                                        (List<Property>) request.getAttribute(PluginConst.PROPERTIES_LIST);
                                                if ((list != null)&&(list.size()!=0)) {%>
                <table>
                    <tr>
                        <th>
                        </th>
                        <th>
                            Имя свойства
                        </th>
                        <th>
                            Тип
                        </th>
                        <th>
                            Группа
                        </th>
                    </tr>
                    <%for (Property item : list) {%>
                    <tr>
                        <td>
                            <div id="objectmenucontainer">
                                <ul id="objectmenu">
                                    <li><a href="<%= response.encodeURL("object-type-action.do")
                                                            + "?"
                                                            + PluginConst.SUBACTION
                                                            + "="
                                                            + PluginConst.EXCLUDE_PROPERTY_FROM_object_TYPE_PAGE
                                                            + "&"
                                                            + PluginConst.PROPERTY_ID
                                                            + "="
                                                            + item.getProperty_id()
                                                            + "&"
                                                            + PluginConst.object_TYPE_ID
                                                            + "="
                                                            + object_type_id%>">Исключить</a></li>
                                    <br>
                                </ul>
                            </div>
                        </td>
                        <td>
                            <%= item.getName()%>
                        </td>
                        <td>
                            <%= item.getPropertyTypeName()%>
                        </td>
                        <td>
                            <%= item.getPropertyGroupName()%>
                        </td>
                    </tr>
                    <%}%>
                </table>
                <%}%>
                <%}%>
                <p>
                <div id="objectmenucontainer">
                    <ul id="objectmenu">
                        <li><a href="<%= response.encodeURL("object-type-action.do")
                                                + "?"
                                                + PluginConst.SUBACTION
                                                + "="
                                                + PluginConst.GET_LIST%>">Вернуться к списку типов оружия</a></li>
                    </ul>
                </div>
                </p>
            </div>
        </div>
    </body>
</html>
